//
//  TMStatusDetailViewController.swift
//  GZWeibo007
//
//  Created by dtt on 15/12/24.
//  Copyright © 2015年 Apple. All rights reserved.
//

import UIKit
import SVPullToRefresh
import SVProgressHUD

class TMStatusDetailViewController: UIViewController ,chilkoperatebutton,chilkinbutton{
    
    private var status: CZStatus
    private let hometable = TMhometableview(frame: CGRectMake(0,0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height-50))
    private let down = TMdownview()
    /// 评论模型
    //    private var comments: [CZDetailCommentModel] = [CZDetailCommentModel]()
    
    // MARK: - 构造函数
    init(status: CZStatus) {
        self.status = status
        super.init(nibName: nil, bundle: nil)
        setview()
    }
    
    //设置view的空间以及位置
    
    func setview()
    {
        view.addSubview(hometable)
        hometable.delega = self
        hometable.status = status
        view.addSubview(down)
        down.delega = self
        
        down.translatesAutoresizingMaskIntoConstraints = false
        self.view.addConstraint(NSLayoutConstraint(item: down, attribute: NSLayoutAttribute.Left, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.Left, multiplier: 1, constant: 0))
        self.view.addConstraint(NSLayoutConstraint(item: down, attribute: NSLayoutAttribute.Right, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.Right, multiplier: 1, constant: 0))
        self.view.addConstraint(NSLayoutConstraint(item: down, attribute: NSLayoutAttribute.Bottom, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.Bottom, multiplier: 1, constant: 0))
        self.view.addConstraint(NSLayoutConstraint(item: down, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 0, constant: 50))
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = UIColor.grayColor()
        title = "微博详情"
        
        
        
    }
    //MARK: -  评论 转发 按钮的代理方法 --->跳转
    func chilkoperatebutton(titlestr : String)
    {
        self.jump(titlestr, status: status)
        
        
    }
    
    func chilkin(status: CZStatus) {
        //点击跳转详情界面
        let con = TMStatusDetailViewController(status: status)
        navigationController?.pushViewController(con, animated: true)
        
    }
    
    
    
    
}

